home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************************
- CFamily.h
-
- Copyright © 1994 B-Ray Software. All rights reserved.
- Developed using Symantec C++ 7.0.2 and Symantec's TCL library.
- Portions of this code courtesy Symantec, Inc.
-
- This code may be freely distributed as long as this notice remains. This code
- may not be used in any commercial software without the consent of B-Ray Software.
-
- ---
-
- Header file for CFamily class
-
- ***********************************************************************************/
-
- #pragma once
-
- #include <CPtrArray.h>
- #include <CPane.h>
-
-
- #define CFamilyList CPtrArray<CFamily>
-
-
- class CFamily {
-
- TCL_DECLARE_CLASS
-
- protected:
- CFamily *itsParent; // parent of the family
- CFamilyList *itsChildren; // children we have
-
- public:
- CFamily();
- virtual ~CFamily();
-
- virtual void SetParent( CFamily *aParent )
- { itsParent = aParent; };
- virtual CFamily *GetParent( void )
- { return itsParent; };
-
- /*
- * Child add/delete methods
- */
- virtual void AppendChild( CFamily *aChild )
- { InsertChildAt( aChild, GetNumberChildren() + 1 ); };
- virtual void PrependChild( CFamily *aChild )
- { InsertChildAt( aChild, 1 ); };
- virtual void InsertChildAt( CFamily *aChild, long index );
- virtual void InsertChildAfter( CFamily *aChild, CFamily *afterChild )
- { InsertChildAt( aChild, FindChildIndex( afterChild ) + 1 ); };
- virtual void RemoveChildAt( long index );
-
- /*
- * Child access methods
- */
- virtual CFamily *GetChildAtIndex( long index )
- { return ( itsChildren && index > 0 && index <= GetNumberChildren() ) ?
- itsChildren->NthItem( index ) : NULL; };
- virtual CFamily *NextChild( long index )
- { return GetChildAtIndex( index + 1 ); };
- virtual CFamily *PrevChild( long index )
- { return GetChildAtIndex( index - 1 ); };
- virtual CFamily *FirstChild( void )
- { return GetChildAtIndex( 1 ); };
- virtual CFamily *LastChild( void )
- { return GetChildAtIndex( GetNumberChildren() ); };
- virtual CFamily *ResolveToLeaf( Boolean beginOrEnd );
-
- /*
- * Misc. child methods
- */
- virtual long FindChildIndex( CFamily *aChild )
- { return itsChildren ? itsChildren->FindIndex( aChild ) : 0; };
-
- virtual long GetNumberChildren( void )
- { return itsChildren ? itsChildren->GetNumItems() : 0; };
-
- /*
- * Pane/Child conversions
- */
- virtual CPane *ChildToPane() = 0;
- virtual CFamily *PaneToChild() = 0;
-
- /*
- * Messaging functions
- */
- virtual void TellChildren( long message, void *param );
- virtual void TellParent( long message, void *param );
-
- virtual void ChildMessage( CFamily *aChild, long message, void *param );
- virtual void ParentMessage( long message, void *param );
-
- /*
- * Stream functions
- */
- virtual void PutTo( CStream &stream );
- virtual void GetFrom( CStream &stream );
-
- };
-